const http = uni.$u.http
function getConfig(config) {
    return {
        ...config,
        header: {
            Accept: 'application/json'
        }
    }
}
// post请求，获取菜单
export default {
    newsDetail: (data, config = {}) => http.get('/news/' + data.id), // 详情
    register: (data, config = {}) => http.post('/user/register', data), // 注册
    login: (data, config = {}) => http.post('/user/login', data), // 登录
    // bannerDetail
    bannerList: (data, config = {}) => http.get('/banner/list', data),
    getBannerDetail: (data, config = {}) => http.get('/banner/' + data.id),
    categoryList: (data, config = {}) => http.get('/category/list', data),
    newsList: (data, config = {}) => http.get('/news/list', data),
    // 课程
    getCourseList: (data, config = {}) => http.get('/course/list', data),
    getCourseInfo: (data, config = {}) => http.get('/course/' + data),
    // 课程章节
    getChapterList: (data, config = {}) => http.get('/courseChapter/list?courseId='+data),
    // 获取用户信息
    getUserInfo: (data, config = {}) => http.get('/user/' + data.id),
    updateMember: (data, config = {}) => http.put('/user/' + data.id, data),
    // 课程练习
    getPracticeList: (data, config = {}) => http.get('/userPracticeRecord/list', data),
    createUserPracticeRecord: (data, config = {}) => http.post('/userPracticeRecord', data),
    getUserPracticeRecord: (data, config = {}) => http.get('/userPracticeRecord/' + data.id),
    submitUserPracticeRecord: (data, config = {}) => http.post('/userPracticeRecord/submit', data),
    updateUserPracticeRecord: (data, config = {}) => http.put('/userPracticeRecord/' + data.id, data),
    policyList: (data, config = {}) => http.get('/policy/list', data),
    // 开始抽奖
    startLottery: (data, config = {}) => http.post('/lotteryRecord/start', data),
    // 可领取的商品列表
    getLotteryGoodsList: (data, config = {}) => http.get('/product/list2', data),
    updateLotteryRecord: (data, config = {}) => http.post('/lotteryRecord/updateProduct', data),
    // config
    getConfig: (data, config = {}) => http.get('/config/list', data),
}
